package yehang.filter;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter(urlPatterns = {"/*"})
public class MyFilter implements Filter {
    private final static Logger logger= LoggerFactory.getLogger(MyFilter.class);
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String id = servletRequest.getParameter("id");
        if(id.equals("ye")){
            filterChain.doFilter(servletRequest,servletResponse);
        }else {
            logger.info(servletRequest.getServerName()+"被拦截了！！");
        }
    }
}
